Skip to content

Commit

Permalink
Merge pull request #252 from remix-pwa/feat/misc
Browse files Browse the repository at this point in the history
Multiple patches + pre-release Remix PWA SPA mode candidate
  • Loading branch information
ShafSpecs authored Aug 11, 2024
2 parents 9b88acb + d4f4414 commit 52ac68c
Show file tree
Hide file tree
Showing 37 changed files with 1,306 additions and 1,237 deletions.
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
engine-strict=true
engine-strict=true
audit=false
fund=false
105 changes: 14 additions & 91 deletions package-lock.json

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

8 changes: 8 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## @remix-pwa/cli 1.2.4 (2024-07-21)


### Bug Fixes

* **cli:** added cross-support for Node pre-21 & Node 21.0.7+ b5f1c1b
* **cli:** upgraded dependencies 0a7470a

## @remix-pwa/cli 1.2.4-dev.2 (2024-07-21)


Expand Down
14 changes: 8 additions & 6 deletions packages/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,11 @@ program
.description('Update all `@remix-pwa/*` packages to latest')
.option('-p, --packages <packages...>', 'Individual packages to update')
.option('-r, --root <root>', "Location of app's root directory (where package.json is located)", '.')
.option('-D, --dev', "Update packages to the latest 'dev' version")
.action(async options => {
const root = resolve(process.cwd(), options.root);
const packagesToUpdate = options.packages ?? [];
const TAG = options.dev ? 'dev' : 'latest';

let packageJSON: any;
console.log(blue('🔃 Reading package.json file...'));
Expand Down Expand Up @@ -244,7 +246,7 @@ program

console.log(blue('Found the following `@remix-pwa/*` packages:'));
allPackages.forEach(pkg => pkg !== '|' && console.log(green(`- ${pkg}`)));
console.log('\n', blue(`🚀 Updating all packages to ${italic('latest')}...`));
console.log('\n', blue(`🚀 Updating all packages to ${italic(TAG)}...`));

allPackages.forEach(pkg => {
if (pkg === '|') return;
Expand All @@ -253,13 +255,13 @@ program

if (depType === 'dep') {
try {
execSync(`npm i ${pkg}@latest`);
execSync(`npm i ${pkg}@${TAG}`);
} catch (err) {
console.error(`${red(`💥 Error occured whilst installing ${pkg}:`)}\n\n${err}`);
}
} else {
try {
execSync(`npm i -D ${pkg}@latest`);
execSync(`npm i -D ${pkg}@${TAG}`);
} catch (err) {
console.error(`${red(`💥 Error occured whilst installing ${pkg}:`)}\n\n${err}`);
}
Expand All @@ -274,7 +276,7 @@ program

console.log(blue('Confirmed and updating the following packages:'));
packagesToUpdate.forEach(pkg => console.log(green(`- @remix-pwa/${pkg}`)));
console.log('\n', blue(`🚀 Updating all confirmed packages to ${italic('latest')}...`));
console.log('\n', blue(`🚀 Updating all confirmed packages to ${italic(TAG)}...`));

packagesToUpdate.forEach(dep => {
let depType: 'dep' | 'devDep' = 'dep';
Expand All @@ -284,13 +286,13 @@ program

if (depType === 'dep') {
try {
execSync(`npm i ${dep}@latest`);
execSync(`npm i ${dep}@${TAG}`);
} catch (err) {
console.error(`${red(`💥 Error occured whilst installing ${dep}:`)}\n\n${err}`);
}
} else {
try {
execSync(`npm i -D ${dep}@latest`);
execSync(`npm i -D ${dep}@${TAG}`);
} catch (err) {
console.error(`${red(`💥 Error occured whilst installing ${dep}:`)}\n\n${err}`);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-pwa/cli",
"version": "1.2.4-dev.2",
"version": "1.2.4",
"description": "An elegant CLI for everything Remix PWA 💖",
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## @remix-pwa/client 3.0.6 (2024-07-21)


### Bug Fixes

* **client:** upgraded dependencies 59a99c8

## @remix-pwa/client 3.0.6-dev.1 (2024-07-20)


Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-pwa/client",
"version": "3.0.6-dev.1",
"version": "3.0.6",
"description": "A set of utilities for client-side development to enhance the native feel of your Remix App",
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions packages/dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## @remix-pwa/dev 3.0.7 (2024-07-21)


### Bug Fixes

* **dev:** upgraded dependencies 2acc972

## @remix-pwa/dev 3.0.7-dev.1 (2024-07-20)


Expand Down
2 changes: 1 addition & 1 deletion packages/dev/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-pwa/dev",
"version": "3.0.7-dev.1",
"version": "3.0.7",
"description": "An esbuild compiler for Service Workers in Remix.run",
"repository": {
"type": "git",
Expand Down
50 changes: 50 additions & 0 deletions packages/dev/src/__test__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ describe('Plugin resolver test suite', () => {
expect(options).toEqual(<ResolvedPWAOptions>{
workerBuildDirectory: '/Users/ryan/Projects/remix-pwa/build/client',
registerSW: 'script',
buildVariables: {
'process.env.NODE_ENV': 'production',
'process.env.__REMIX_PWA_SPA_MODE': 'false',
},
workerSourceMap: false,
publicPath: '/build/',
entryWorkerFile: 'entry.worker.ts',
Expand Down Expand Up @@ -100,6 +104,10 @@ describe('Plugin resolver test suite', () => {
workerBuildDirectory: '/Users/ryan/Projects/remix-pwa/public',
registerSW: null,
scope: '/pwa',
buildVariables: {
'process.env.NODE_ENV': 'production',
'process.env.__REMIX_PWA_SPA_MODE': 'false',
},
rootDirectory: '/Users/ryan/Projects/remix-pwa',
appDirectory: '/Users/ryan/Projects/remix-pwa/app',
ignoredSWRouteFiles: [],
Expand Down Expand Up @@ -131,6 +139,48 @@ describe('Plugin resolver test suite', () => {
registerSW: 'script',
workerSourceMap: false,
publicPath: '/build/',
buildVariables: {
'process.env.NODE_ENV': 'production',
'process.env.__REMIX_PWA_SPA_MODE': 'false',
},
entryWorkerFile: 'entry.worker.ts',
workerEntryPoint: '@remix-pwa/worker-runtime',
scope: '/',
rootDirectory: '/Users/ryan/Projects/remix-pwa',
appDirectory: '/Users/ryan/Projects/remix-pwa/app',
ignoredSWRouteFiles: [],
workerMinify: false,
workerName: 'entry.worker',
serviceWorkerPath: '/Users/ryan/Projects/remix-pwa/app/entry.worker.ts',
routes: {},
});
});

test('should inject user-defined variables', async () => {
const { resolveOptions } = await import('../resolver.js');

const options = await resolveOptions(
{
entryWorkerFile: '/entry.worker.ts',
buildVariables: {
'process.env.__REMIX_PWA_SPA_MODE': 'false',
'process.env.API_URL': 'https://api.example.com',
},
workerBuildDirectory: '/out/dist/',
},
mockViteConfig as ResolvedConfig
);

assert(options);
expect(options).toEqual(<ResolvedPWAOptions>{
workerBuildDirectory: '/Users/ryan/Projects/remix-pwa/out/dist',
registerSW: 'script',
workerSourceMap: false,
publicPath: '/build/',
buildVariables: {
'process.env.__REMIX_PWA_SPA_MODE': 'false',
'process.env.API_URL': 'https://api.example.com',
},
entryWorkerFile: 'entry.worker.ts',
workerEntryPoint: '@remix-pwa/worker-runtime',
scope: '/',
Expand Down
1 change: 1 addition & 0 deletions packages/dev/src/__test__/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const mockViteConfig = <Partial<ResolvedConfig>>{
assetsBuildDirectory: '/Users/ryan/Projects/remix-pwa/public/build',
ignoredRouteFiles: ['**/.*'],
publicPath: '/build/',
ssr: true,
},
},
};
Loading

0 comments on commit 52ac68c

Please sign in to comment.