Skip to content

Commit

Permalink
chore: build script updates (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Jul 24, 2024
1 parent b08c122 commit 18f9493
Show file tree
Hide file tree
Showing 12 changed files with 345 additions and 77 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
node-version: 20.x
- run: npm ci
- run: npm run lint
- run: npm run docs:diff

test:
runs-on: ubuntu-latest
Expand All @@ -33,9 +34,5 @@ jobs:
cache: npm
- run: npm ci
- run: npm run test
- run: npm run docs:diff
if: matrix.node-version == 20
- run: npm run test:node
if: matrix.node-version >= 20
- run: npm run test:pack
if: matrix.node-version >= 20
40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,22 @@ Example:
import { stringify as uuidStringify } from 'uuid';

const uuidBytes = Uint8Array.of(
0x6e, 0xc0, 0xbd, 0x7f,
0x11, 0xc0, 0x43, 0xda,
0x97, 0x5e, 0x2a, 0x8a,
0xd9, 0xeb, 0xae, 0x0b,
0x6e,
0xc0,
0xbd,
0x7f,
0x11,
0xc0,
0x43,
0xda,
0x97,
0x5e,
0x2a,
0x8a,
0xd9,
0xeb,
0xae,
0x0b
);

uuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
Expand Down Expand Up @@ -250,10 +262,22 @@ import { v4 as uuidv4 } from 'uuid';

const v4options = {
random: Uint8Array.of(
0x10, 0x91, 0x56, 0xbe,
0xc4, 0xfb, 0xc1, 0xea,
0x71, 0xb4, 0xef, 0xe1,
0x67, 0x1c, 0x58, 0x36,
0x10,
0x91,
0x56,
0xbe,
0xc4,
0xfb,
0xc1,
0xea,
0x71,
0xb4,
0xef,
0xe1,
0x67,
0x1c,
0x58,
0x36
),
};
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
Expand Down
6 changes: 5 additions & 1 deletion examples/browser-esmodules/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import {
v6ToV1 as uuidv6ToV1,
v7 as uuidv7,
} from './node_modules/uuid/dist/esm-browser/index.js';
import pkg from './node_modules/uuid/package.json' with { type: 'json' };

// Import attribute syntax is still awaiting finalization. In the meantime we
// use dynamic import to allows to specifyg both "assert" and "with" clauses.
// See https://github.com/tc39/proposal-import-attributes
const pkg = await import('uuid/package.json', { assert: { type: 'json' }, with: { type: 'json' } });

console.log('pkg', pkg);

Expand Down
12 changes: 6 additions & 6 deletions examples/browser-rollup/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions examples/browser-webpack/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions examples/node-commonjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion examples/node-esmodules/example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import {
v6ToV1 as uuidv6ToV1,
v7 as uuidv7,
} from 'uuid';
import pkg from 'uuid/package.json' assert { type: 'json' };

// Import attribute syntax is still awaiting finalization. In the meantime we
// use dynamic import to allows to specifyg both "assert" and "with" clauses.
// See https://github.com/tc39/proposal-import-attributes
const pkg = await import('uuid/package.json', { assert: { type: 'json' }, with: { type: 'json' } });

console.log('uuidv1()', uuidv1());

Expand Down
12 changes: 6 additions & 6 deletions examples/node-esmodules/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions examples/node-jest/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 18f9493

Please sign in to comment.