Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,27 @@

#### 3. Update your project's package.json

- **Add dev and build scripts:** In your web project's `package.json` file, add the `dev` and `build` scripts:
- **Add dev and build scripts:** In your web project's `package.json` file, add the `dev` and `build` scripts.

````
"scripts": {
"dev": "npx @build-in-blocks/dev.build@1.0.4 dev:build",
"build": "npx @build-in-blocks/dev.build@1.0.4 prod:build"
// your other npm scripts in your project goes here as usual
},
````
- For `macOS` and `linux`, use:

````
"scripts": {
"dev": "blocks.pkg.dev.build dev:build",
"build": "blocks.pkg.dev.build prod:build"
// your other npm scripts in your project goes here as usual
},
````

- For `windows OS`, use:

> [!IMPORTANT]
> About `@build-in-blocks/dev.build@[VERSION_NUMBER_HERE]` in the scripts: Make sure the version number used your in your `dev` and `build` scripts is the same as the version of the `@build-in-blocks/dev.build` package in your `package.json` file's `devDependencies`.
````
"scripts": {
"dev": "blocks.pkg.dev.build.cmd dev:build",
"build": "blocks.pkg.dev.build.cmd prod:build"
// your other npm scripts in your project goes here as usual
},
````

- **You need this too:** Add these in the your web project's `package.json` file too:

Expand Down
5 changes: 3 additions & 2 deletions bin/pkg.internal.cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { blocksTerminalLogger } from '../config.root/blocks.packages.js';
//-
import { require, __dirname, internalPkgJSON } from '../config.root/root.js';
import { require, __dirname, internalPkgJSON, isWindowsOS, windowsCmdextension } from '../config.root/root.js';
//-
import { renameRootTypeFileInBuildOutputFolder } from './helper/rename-root-type.js';
//-
Expand Down Expand Up @@ -92,8 +92,8 @@

spawnChildProcess.on('exit', (code) => {
if (code === 0 && isProd) {
console.log('============================================\n');

Check warning on line 95 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (22.x)

Unexpected console statement

Check warning on line 95 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (20.x)

Unexpected console statement

Check warning on line 95 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (23.x)

Unexpected console statement

Check warning on line 95 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (25.x)

Unexpected console statement

Check warning on line 95 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (24.x)

Unexpected console statement
console.log('[PROD] Bundling complete.\n[PROD] Generating type definitions...');

Check warning on line 96 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (22.x)

Unexpected console statement

Check warning on line 96 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (20.x)

Unexpected console statement

Check warning on line 96 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (23.x)

Unexpected console statement

Check warning on line 96 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (25.x)

Unexpected console statement

Check warning on line 96 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (24.x)

Unexpected console statement
try {
// --------------------------------------------------------------
// Execute the ENGINE'S internal tsc relative to the user project
Expand All @@ -101,7 +101,8 @@
// Run tsc to generate .d.ts files into the 'build' folder
// Using the user app's local tsc
// -------------------------------------------------------
execSync(`${tscPath} --emitDeclarationOnly`, {
const tscPathForRelevantOS = isWindowsOS ? `tsc${windowsCmdextension}` : tscPath; // This check makes it compatible with Windows OS (in production)
execSync(`${tscPathForRelevantOS} --emitDeclarationOnly`, {
stdio: 'inherit',
env: {
...process.env,
Expand All @@ -111,7 +112,7 @@
//-
renameRootTypeFileInBuildOutputFolder();
//-
console.log('[PROD] Types (.d.ts files) generated successfully.');

Check warning on line 115 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (22.x)

Unexpected console statement

Check warning on line 115 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (20.x)

Unexpected console statement

Check warning on line 115 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (23.x)

Unexpected console statement

Check warning on line 115 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (25.x)

Unexpected console statement

Check warning on line 115 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (24.x)

Unexpected console statement
} catch (e) {
blocksTerminalLogger({
internalPackage: {
Expand All @@ -121,7 +122,7 @@
originalErrorMessage: e,
});
}
console.log('');

Check warning on line 125 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (22.x)

Unexpected console statement

Check warning on line 125 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (20.x)

Unexpected console statement

Check warning on line 125 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (23.x)

Unexpected console statement

Check warning on line 125 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (25.x)

Unexpected console statement

Check warning on line 125 in bin/pkg.internal.cli.js

View workflow job for this annotation

GitHub Actions / call-shared-logic / validate (24.x)

Unexpected console statement
}
process.exit(code || 0);
});
Expand Down
6 changes: 6 additions & 0 deletions config.root/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const __dirname = path.dirname(__filename);
const internalProjectRoot = path.join(__dirname, '../', 'package.json');
const internalPkgJSON = JSON.parse(fs.readFileSync(internalProjectRoot, 'utf-8'));

const isWindowsOS = process.platform === 'win32';
const windowsCmdextension = '.cmd';

export {
//-------------------------------
// Export global access variables
Expand All @@ -21,4 +24,7 @@ export {
//-
internalProjectRoot,
internalPkgJSON,
//-
isWindowsOS,
windowsCmdextension,
};
16 changes: 0 additions & 16 deletions docs.release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,10 @@

#

#### This library

- In the **root README**, always remember to change `@build-in-blocks/dev.build@[VERSION_NUMBER]` for the npm scripts part of the docs too, as you bump up the `package.json` version.

#

#### Connected user apps

- The "user app" built with this library requires you to build/generate a new bundle for consumption - Don't forget to run the `build` script command before publishing.

- Before release (of your "user app" - e.g. dom.autoquery in this case), you always have to check that npx is referencing the correct/updated version in the scripts section of the package.json e.g. @1.0.0 in this case.

````
"scripts": {
"dev": "npx @build-in-blocks/dev.build@1.0.0 dev:build",
"build": "npx @build-in-blocks/dev.build@1.0.0 prod:build"
// your other npm scripts in your project goes here as usual
},
````

#

#### Build in blocks libraries in general
Expand Down
42 changes: 21 additions & 21 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@build-in-blocks/dev.build",
"version": "1.0.4",
"version": "1.0.5",
"description": "Production and development bundler build setup for your typescript web-related projects.",
"type": "module",
"bin": {
Expand Down
Loading