Skip to content

Commit ccdd0f5

Browse files
committed
fix: projects start now call scripts directly
Now when running npm start in a project created with gobstones-scripts the inner command calls the .scripts/_cli.ts file and not gobstones-scripts run command.
1 parent 59e65f5 commit ccdd0f5

File tree

23 files changed

+727
-211
lines changed

23 files changed

+727
-211
lines changed

.scripts/prettify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ import { $ } from './_helpers.ts';
2020
await $ `prettier --no-error-on-unmatched-pattern --write ./.husky/*[^_]`;
2121
await $ `prettier --no-error-on-unmatched-pattern --write ./{.github,.vscode,src,test}/{**,.}/*.{js,jsx,cjs,mjs,ts,tsx,mts,cts,yml,md,json,js}`;
2222
await $ `prettier --no-error-on-unmatched-pattern --write {.czrc,.editorconfig,.gitignore,.npmignore,.npmrc,.prettierrc}`;
23-
await $ `prettier --no-error-on-unmatched-pattern --write ./*.{js,jsx,cjs,mjs,ts,tsx,mts,cts,yml,md,json,js`;
23+
await $ `prettier --no-error-on-unmatched-pattern --write ./*.{js,jsx,cjs,mjs,ts,tsx,mts,cts,yml,md,json,js}`;

CHANGELOG.md

Lines changed: 88 additions & 97 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 87 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ The CLI is divided into a main command and multiple sub-commands.
9494
The main command is useful for getting usage help. Run the command without any
9595
flags to get information about the different options. Useful flags include:
9696

97-
- `-h --help`: display help for command
98-
- `-v --version`: output the version number
99-
- `-c, --config`: display the tool's detected configuration
97+
- `-h --help`: display help for command
98+
- `-v --version`: output the version number
99+
- `-c, --config`: display the tool's detected configuration
100100

101101
Utilities happen through sub-commands:
102102

@@ -108,25 +108,25 @@ create a new folder with the project name that will hold your project. On the
108108
other hand, `init` will initialize the project in the current directory, thus,
109109
expecting the same to be empty.
110110

111-
- `create [options] <project-name>`: create a new project with the given
112-
project name.
113-
- `init [options]`: initialize a project in the current folder.
111+
- `create [options] <project-name>`: create a new project with the given
112+
project name.
113+
- `init [options]`: initialize a project in the current folder.
114114

115115
A `<project-name>` is any valid project identifier, that is, any string that i
116116
valid folder name and contains no spaces.
117117

118118
Valid options include:
119119

120-
- `-t, --type <project-type>`: the project type to create, one of `Library`,
121-
`CLILibrary`, `ReactLibrary`, `NonCode` (default: "Library")
122-
- `-p, --package-manager <package-manager>`: the project manager to use, one
123-
of `npm`, `yarn`, `pnpm`(default: "npm")
124-
- `-s --silent`: run silently, not displaying the tool's banner (default:
125-
false)
126-
- `-D, --debug`: run in debug mode, printing all the internal tool's
127-
processing (default: false)
128-
- `-T, --test`: run using verdaccio as a registry (default: false)
129-
- `-h, --help`: display help for command
120+
- `-t, --type <project-type>`: the project type to create, one of `Library`,
121+
`CLILibrary`, `ReactLibrary`, `NonCode` (default: "Library")
122+
- `-p, --package-manager <package-manager>`: the project manager to use, one
123+
of `npm`, `yarn`, `pnpm`(default: "npm")
124+
- `-s --silent`: run silently, not displaying the tool's banner (default:
125+
false)
126+
- `-D, --debug`: run in debug mode, printing all the internal tool's
127+
processing (default: false)
128+
- `-T, --test`: run using verdaccio as a registry (default: false)
129+
- `-h, --help`: display help for command
130130

131131
A special mention is to be held for the `-T` flag, which is not
132132
self-explanatory. See the **Manually testing newer versions of the library**
@@ -148,21 +148,21 @@ The `update` sub-command is intended to update the project's configuration files
148148
that live at the root of the project. This command is intended to be executed
149149
inside an already created project.
150150

151-
- `update [options]`: update the root files of the project.
151+
- `update [options]`: update the root files of the project.
152152

153153
The command has the following options.
154154

155-
- `-i, --items <item> `: the items to update. One of `all`, `husky`, `github`,
156-
`vscode`, `license`, `contributing`, `editorconfig`, `prettier`, `npm`,
157-
`eslint`, `git`, `commitlint` (default: `all`)
158-
- `-t, --type <project-type>`: the project type to create, one of `Library`,
159-
`CLILibrary`, `ReactLibrary`, `NonCode` (default: "Library")
160-
- `-s --silent`: run silently, not displaying the tool's banner (default:
161-
false)
162-
- `-D, --debug`: run in debug mode, printing all the internal tool's
163-
processing (default: false)
164-
- `-T, --test`: run using verdaccio as a registry (default: false)
165-
- `-h, --help`: display help for command
155+
- `-i, --items <item> `: the items to update. One of `all`, `husky`, `github`,
156+
`vscode`, `license`, `contributing`, `editorconfig`, `prettier`, `npm`,
157+
`eslint`, `git`, `commitlint` (default: `all`)
158+
- `-t, --type <project-type>`: the project type to create, one of `Library`,
159+
`CLILibrary`, `ReactLibrary`, `NonCode` (default: "Library")
160+
- `-s --silent`: run silently, not displaying the tool's banner (default:
161+
false)
162+
- `-D, --debug`: run in debug mode, printing all the internal tool's
163+
processing (default: false)
164+
- `-T, --test`: run using verdaccio as a registry (default: false)
165+
- `-h, --help`: display help for command
166166

167167
By default, all root files are updated, but through the `-i` flag a specific
168168
file can be updated. `-i` flag expects only one file at a time, that is, execute
@@ -200,19 +200,19 @@ your project, and these files will be used instead of the ones in the
200200
gobstones-scripts folder. Note that usually you will not need to eject all
201201
files, but only the one of a specific tool, use `-i` flag for that.
202202

203-
- `eject [options]`: eject the configuration files of the project.
203+
- `eject [options]`: eject the configuration files of the project.
204204

205205
This sub-command have the following options:
206206

207-
- `-i, --items <item> `: The items to update. One of `all`, nps`, `rollup`,
208-
`typescript`, `typedoc`, `jest` (default: "all")
209-
- `-t, --type <project-type>`: the project type to create, one of `Library`,
210-
`CLILibrary`, `ReactLibrary`, `NonCode` (default: "Library")
211-
- `-s --silent`: run silently, not displaying the tool's banner (default:
212-
false)
213-
- `-D, --debug`: run in debug mode, printing all the internal tool's
214-
processing (default: false)
215-
- `-h, --help`: display help for command
207+
- `-i, --items <item> `: The items to update. One of `all`, nps`, `rollup`,
208+
`typescript`, `typedoc`, `jest` (default: "all")
209+
- `-t, --type <project-type>`: the project type to create, one of `Library`,
210+
`CLILibrary`, `ReactLibrary`, `NonCode` (default: "Library")
211+
- `-s --silent`: run silently, not displaying the tool's banner (default:
212+
false)
213+
- `-D, --debug`: run in debug mode, printing all the internal tool's
214+
processing (default: false)
215+
- `-h, --help`: display help for command
216216

217217
An example will be:
218218

@@ -231,43 +231,43 @@ The `run` sub-command is used to execute a particular `nps` command through the
231231
abstracted configuration provided by `gobstones-script` (except ejected files,
232232
in which cae, the ejected configuration will be used).
233233

234-
- `run [options] [command] [...args]`: run a command with nps.
234+
- `run [options] [command] [...args]`: run a command with nps.
235235

236236
As you can see, you can call `run` with no options. In this case, the default
237237
`nps` command will be executed. Else, you can provide a particular command (one
238238
of the nps provided commands) and some arguments.
239239

240240
Available options include:
241241

242-
- `-t, --type <project-type>`: the project type to create, one of `Library`,
243-
`CLILibrary`, `ReactLibrary`, `NonCode` (default: "Library")
244-
- `-p, --package-manager <package-manager>`: the project manager to use, one
245-
of `npm`, `yarn`, `pnpm`(default: "npm")
246-
- `-s --silent`: run silently, not displaying the tool's banner (default:
247-
false)
248-
- `-D, --debug`: run in debug mode, printing all the internal tool's
249-
processing (default: false)
250-
- `-h, --help`: display help for command
242+
- `-t, --type <project-type>`: the project type to create, one of `Library`,
243+
`CLILibrary`, `ReactLibrary`, `NonCode` (default: "Library")
244+
- `-p, --package-manager <package-manager>`: the project manager to use, one
245+
of `npm`, `yarn`, `pnpm`(default: "npm")
246+
- `-s --silent`: run silently, not displaying the tool's banner (default:
247+
false)
248+
- `-D, --debug`: run in debug mode, printing all the internal tool's
249+
processing (default: false)
250+
- `-h, --help`: display help for command
251251

252252
Available commands depend on project type, and can be found by executing the
253253
default action, as presenting the help is the default behavior for any project.
254254
Some common actions include
255255

256-
- `dev`: run the project in development mode.
257-
- `build`: build the project and output it to `./dist`
258-
- `test`: run the project's tests, generating coverage reports at
259-
`./coverage`.
260-
- `test -- --serve`: run the project's tests, generating coverage reports at
261-
`./coverage`. and serve the generated folder in a local server.
262-
- `doc`: build the documentation and output it to `./docs`
263-
- `doc -- --serve`: build the documentation and output it to `./docs`, and
264-
serve the folder in a local server.
265-
- `lint`: lint the files in the project.
266-
- `lint -- --fix`: lint the files in the project and fix all auto-fixable
267-
errors.
268-
- `prettify`: run prettier with auto-fix in all project files.
269-
- `clear`: delete all auto-generated files.
270-
- `changelog`: append the latest tag information to the changelog.
256+
- `dev`: run the project in development mode.
257+
- `build`: build the project and output it to `./dist`
258+
- `test`: run the project's tests, generating coverage reports at
259+
`./coverage`.
260+
- `test -- --serve`: run the project's tests, generating coverage reports at
261+
`./coverage`. and serve the generated folder in a local server.
262+
- `doc`: build the documentation and output it to `./docs`
263+
- `doc -- --serve`: build the documentation and output it to `./docs`, and
264+
serve the folder in a local server.
265+
- `lint`: lint the files in the project.
266+
- `lint -- --fix`: lint the files in the project and fix all auto-fixable
267+
errors.
268+
- `prettify`: run prettier with auto-fix in all project files.
269+
- `clear`: delete all auto-generated files.
270+
- `changelog`: append the latest tag information to the changelog.
271271

272272
See the **Running commands using gobstones-scripts** for more information.
273273

@@ -282,16 +282,16 @@ modifications to the `package.json` file.
282282
When running a command using _gobstones-scripts_ the tool loads all
283283
configuration for the different tooling from one of two locations.
284284

285-
- If a configuration file for a tool is present at the root of your project,
286-
that configuration is used. As an example, if you have a `rollup.config.js`
287-
file in the root of your project, then that file is used to load the Rollup
288-
configuration.
289-
- If a configuration file for a tool is not present at the root of your
290-
project, then the default configuration file from gobstones-scripts is used.
291-
This configuration files are at
292-
`./node_modules/@gobstones/gobstones-scripts/config`, and they should not be
293-
modified by the end user. If you need changes over a default configuration,
294-
you should eject that configuration file to the root of your project.
285+
- If a configuration file for a tool is present at the root of your project,
286+
that configuration is used. As an example, if you have a `rollup.config.js`
287+
file in the root of your project, then that file is used to load the Rollup
288+
configuration.
289+
- If a configuration file for a tool is not present at the root of your
290+
project, then the default configuration file from gobstones-scripts is used.
291+
This configuration files are at
292+
`./node_modules/@gobstones/gobstones-scripts/config`, and they should not be
293+
modified by the end user. If you need changes over a default configuration,
294+
you should eject that configuration file to the root of your project.
295295

296296
## Running commands using gobstones-scripts
297297

@@ -343,7 +343,6 @@ configuration folder in `node_modules`.
343343
If you require the tool's detected configuration file you may import it from the
344344
`_helpers.ts` file at the `.scripts` folder.
345345

346-
347346
## API
348347

349348
You can access the API by importing the module
@@ -394,21 +393,21 @@ the experimental state.
394393

395394
The underlying technologies in use include
396395

397-
- **typescript** (tsc for building)
398-
- **rollup** (for bundling libraries and cli-libraries)
399-
- **vite** (for bundling react-libraries)
400-
- **eslint** (for linting)
401-
- **prettier** (for styling)
402-
- **typedoc** (for documentation generation)
403-
- **storybook** (for testing and documenting react-libraries)
404-
- **zx** (for orchestrating the tooling and scripts)
405-
- **husky** (for hooking into git actions)
396+
- **typescript** (tsc for building)
397+
- **rollup** (for bundling libraries and cli-libraries)
398+
- **vite** (for bundling react-libraries)
399+
- **eslint** (for linting)
400+
- **prettier** (for styling)
401+
- **typedoc** (for documentation generation)
402+
- **storybook** (for testing and documenting react-libraries)
403+
- **zx** (for orchestrating the tooling and scripts)
404+
- **husky** (for hooking into git actions)
406405

407406
Other files copied to your project will include
408407

409-
- **.editorconfig** (for editor styling, matching prettier)
410-
- **.gitignore** (for git management)
411-
- **.npmignore** (for publishing configuration)
408+
- **.editorconfig** (for editor styling, matching prettier)
409+
- **.gitignore** (for git management)
410+
- **.npmignore** (for publishing configuration)
412411

413412
Also a **.github** folder will configure GitHub actions, and a **.vscode**
414413
folder will configure your Visual Studio Code environment on first run.
@@ -445,8 +444,8 @@ npm start build
445444
```
446445

447446
The `test` performs linting, and then it attempts to create a project of each
448-
type available at `test/.temp` and run the basic command of `dev`, `build`,
449-
`test` and `doc` in each created project. You may run it by calling:
447+
type available at `test/.temp` and run the basic command of `dev`, `build`,
448+
`test` and `doc` in each created project. You may run it by calling:
450449

451450
```sh
452451
npm start test

package.json

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gobstones/gobstones-scripts",
3-
"version": "0.10.2",
3+
"version": "0.10.3",
44
"description": "Scripts to abstract away build configuration of Gobstones Project's libraries and modules.",
55
"repository": {
66
"type": "git",
@@ -9,13 +9,7 @@
99
"homepage": "https://gobstones.github.io/gobstones-scripts",
1010
"author": "Alan Rodas Bonjour <alanrodas@gmail.com>",
1111
"license": "AGPL-3.0",
12-
"keywords": [
13-
"Gobstones",
14-
"Scripts",
15-
"Build",
16-
"Run",
17-
"Projects"
18-
],
12+
"keywords": ["Gobstones", "Scripts", "Build", "Run", "Projects"],
1913
"type": "module",
2014
"bin": {
2115
"gobstones-scripts": "./dist/esm/cli.cjs"
@@ -35,12 +29,8 @@
3529
},
3630
"typesVersions": {
3731
"*": {
38-
"*": [
39-
"./dist/index.d.ts"
40-
],
41-
"cli": [
42-
"./dist/cli.d.ts"
43-
]
32+
"*": ["./dist/index.d.ts"],
33+
"cli": ["./dist/cli.d.ts"]
4434
}
4535
},
4636
"packageManager": "npm@11.6.2",

project-types/CLILibrary/package-definition.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"scripts": {
3434
"prepare": "is-ci || husky install",
3535
"prepack": "npm start build",
36-
"start": "gobstones-scripts run",
36+
"start": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-strip-types zx ./.scripts/_cli.ts",
3737
"gbs": "gobstones-scripts"
3838
},
3939
"config": {
@@ -47,7 +47,7 @@
4747
"commander": "^11.1.0"
4848
},
4949
"devDependencies": {
50-
"@gobstones/gobstones-scripts": "^0.10.2",
50+
"@gobstones/gobstones-scripts": "^0.10.3",
5151
"husky": "^8.0.2"
5252
}
5353
}

project-types/Common/scripts/prettify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ import { $ } from './_helpers.ts';
2020
await $`prettier --no-error-on-unmatched-pattern --write ./.husky/*[^_]`;
2121
await $`prettier --no-error-on-unmatched-pattern --write ./{.github,.vscode,src,test}/{**,.}/*.{js,jsx,cjs,mjs,ts,tsx,mts,cts,yml,md,json,js}`;
2222
await $`prettier --no-error-on-unmatched-pattern --write {.czrc,.editorconfig,.gitignore,.npmignore,.npmrc,.prettierrc}`;
23-
await $`prettier --no-error-on-unmatched-pattern --write ./*.{js,jsx,cjs,mjs,ts,tsx,mts,cts,yml,md,json,js`;
23+
await $`prettier --no-error-on-unmatched-pattern --write ./*.{js,jsx,cjs,mjs,ts,tsx,mts,cts,yml,md,json,js}`;

project-types/Library/package-definition.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"scripts": {
2626
"prepare": "is-ci || husky install",
2727
"prepack": "npm start build",
28-
"start": "gobstones-scripts run",
28+
"start": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-strip-types zx ./.scripts/_cli.ts",
2929
"gbs": "gobstones-scripts"
3030
},
3131
"config": {
@@ -38,7 +38,7 @@
3838
"@gobstones/gobstones-core": "^0.5.5"
3939
},
4040
"devDependencies": {
41-
"@gobstones/gobstones-scripts": "^0.10.2",
41+
"@gobstones/gobstones-scripts": "^0.10.3",
4242
"husky": "^8.0.2"
4343
}
4444
}

project-types/NonCode/package-definition.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"scripts": {
2626
"prepare": "is-ci || husky install",
2727
"prepack": "npm start build",
28-
"start": "gobstones-scripts run",
28+
"start": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-strip-types zx ./.scripts/_cli.ts",
2929
"gbs": "gobstones-scripts"
3030
},
3131
"config": {
@@ -37,7 +37,7 @@
3737
},
3838
"dependencies": {},
3939
"devDependencies": {
40-
"@gobstones/gobstones-scripts": "^0.10.2",
40+
"@gobstones/gobstones-scripts": "^0.10.3",
4141
"husky": "^8.0.2"
4242
}
4343
}

0 commit comments

Comments
 (0)