Skip to content

Commit

Permalink
chore: support create engine offline mode
Browse files Browse the repository at this point in the history
Also fixes unit test snapshots
  • Loading branch information
JoshuaKGoldberg committed Jan 4, 2025
1 parent 98c1226 commit d78f59c
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 54 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@clack/prompts": "^0.9.0",
"@prettier/sync": "^0.5.2",
"chalk": "^5.4.1",
"create": "0.1.0-alpha.8",
"create": "0.1.0-alpha.10",
"cspell-populate-words": "^0.3.0",
"execa": "^9.5.2",
"git-remote-origin-url": "^4.0.0",
Expand Down Expand Up @@ -89,7 +89,7 @@
"all-contributors-cli": "6.26.1",
"c8": "10.1.3",
"console-fail-test": "0.5.0",
"create-testers": "0.1.0-alpha.8",
"create-testers": "0.1.0-alpha.10",
"cspell": "8.17.1",
"eslint": "9.17.0",
"eslint-plugin-jsdoc": "50.6.1",
Expand Down
73 changes: 33 additions & 40 deletions pnpm-lock.yaml

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

16 changes: 8 additions & 8 deletions src/next/blocks/blockPackageJson.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ describe("blockPackageJson", () => {
expect(creation).toMatchInlineSnapshot(`
{
"files": {
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"]}",
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"]}",
},
"scripts": [
{
"commands": [
"pnpm install",
"pnpm install --offline",
],
"phase": 1,
},
Expand All @@ -36,12 +36,12 @@ describe("blockPackageJson", () => {
expect(creation).toMatchInlineSnapshot(`
{
"files": {
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"]}",
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"]}",
},
"scripts": [
{
"commands": [
"pnpm install",
"pnpm install --offline",
],
"phase": 1,
},
Expand Down Expand Up @@ -73,12 +73,12 @@ describe("blockPackageJson", () => {
expect(creation).toMatchInlineSnapshot(`
{
"files": {
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"other":true}",
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"other":true}",
},
"scripts": [
{
"commands": [
"pnpm install",
"pnpm install --offline",
"pnpm dedupe",
],
"phase": 1,
Expand Down Expand Up @@ -108,12 +108,12 @@ describe("blockPackageJson", () => {
expect(creation).toMatchInlineSnapshot(`
{
"files": {
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"devDependencies":{"is-even":"4.5.6"},"other":true}",
"package.json": "{"name":"test-repository","version":"0.0.0","description":"Test description","repository":{"type":"git","url":"git+https://github.com/test-owner/test-repository.git"},"license":"MIT","author":{"email":"[email protected]"},"type":"module","main":"./lib/index.js","files":["README.md","package.json"],"dependencies":{"is-odd":"1.2.3"},"devDependencies":{"is-even":"4.5.6"},"other":true}",
},
"scripts": [
{
"commands": [
"pnpm install",
"pnpm install --offline",
"pnpm dedupe",
],
"phase": 1,
Expand Down
7 changes: 5 additions & 2 deletions src/next/blocks/blockPackageJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const blockPackageJson = base.createBlock({
],
};
},
produce({ addons, options }) {
produce({ addons, offline, options }) {
const dependencies = {
...options.packageData?.dependencies,
...addons.properties.dependencies,
Expand Down Expand Up @@ -97,7 +97,10 @@ export const blockPackageJson = base.createBlock({
},
scripts: [
{
commands: ["pnpm install", ...addons.cleanupCommands],
commands: [
offline ? "pnpm install" : "pnpm install --offline",
...addons.cleanupCommands,
],
phase: CommandPhase.Install,
},
],
Expand Down
4 changes: 2 additions & 2 deletions src/steps/writing/creation/writePackageJson.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe("writePackageJson", () => {
},
"repository": {
"type": "git",
"url": "https://github.com/test-owner/test-repository.git",
"url": "git+https://github.com/test-owner/test-repository.git",
},
"scripts": {
"build": "tsup",
Expand Down Expand Up @@ -168,7 +168,7 @@ describe("writePackageJson", () => {
},
"repository": {
"type": "git",
"url": "https://github.com/test-owner/test-repository.git",
"url": "git+https://github.com/test-owner/test-repository.git",
},
"scripts": {
"format": "prettier .",
Expand Down

0 comments on commit d78f59c

Please sign in to comment.