wirejs-deploy-amplify-basic 0.0.114-realtime → 0.0.116-realtime
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.js
CHANGED
|
@@ -5,8 +5,7 @@ import path from 'path';
|
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import { rimraf } from 'rimraf';
|
|
7
7
|
import copy from 'recursive-copy';
|
|
8
|
-
import
|
|
9
|
-
import { exec, execSync } from 'child_process';
|
|
8
|
+
import { execSync } from 'child_process';
|
|
10
9
|
|
|
11
10
|
const CWD = process.cwd();
|
|
12
11
|
const __filename = import.meta.url.replace(/^file:/, '');
|
|
@@ -85,53 +84,16 @@ async function installDeps() {
|
|
|
85
84
|
*
|
|
86
85
|
* @returns {Promise<string>} output filename
|
|
87
86
|
*/
|
|
88
|
-
async function
|
|
89
|
-
console.log("
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const outputPath = path.join(BACKEND_DIR, 'api.js');
|
|
94
|
-
|
|
95
|
-
// intermediate build of the resource overrides. this includes any deps we have
|
|
96
|
-
// on the original `wirejs-resources` into the intermediate bundle. doing this
|
|
97
|
-
// allows us to completely override (alias) `wirejs-resources` in the final build
|
|
98
|
-
// without creating a circular alias.
|
|
99
|
-
// console.log("creating intermediate wirejs-resources overrides");
|
|
100
|
-
// await esbuild.build({
|
|
101
|
-
// entryPoints: [path.join(SELF_DIR, 'wirejs-resources-overrides', 'index.js')],
|
|
102
|
-
// bundle: true,
|
|
103
|
-
// outfile: RESOURCE_OVERRIDES_BUILD,
|
|
104
|
-
// platform: 'node',
|
|
105
|
-
// format: 'esm',
|
|
106
|
-
// external: ['@aws-sdk/client-s3']
|
|
107
|
-
// });
|
|
108
|
-
|
|
109
|
-
// exploratory build. builds using our overrides, which will emit a manifest of
|
|
110
|
-
// resources required by the API when imported.
|
|
111
|
-
console.log("creating api bundle using platform overrides");
|
|
112
|
-
await esbuild.build({
|
|
113
|
-
entryPoints: [path.join('.', 'api', 'index.ts')],
|
|
114
|
-
bundle: false,
|
|
115
|
-
outfile: outputPath,
|
|
116
|
-
platform: 'node',
|
|
117
|
-
format: 'esm',
|
|
118
|
-
// alias: {
|
|
119
|
-
// 'wirejs-resources': RESOURCE_OVERRIDES_BUILD
|
|
120
|
-
// },
|
|
121
|
-
// external: ['@aws-sdk/client-s3']
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// exploratory import. not strictly necessary until we're actually using the manifest
|
|
125
|
-
// to direct construction of backend resources. for now, this is just informational/
|
|
126
|
-
// confirmational that we're building things properly.
|
|
127
|
-
await import(outputPath);
|
|
87
|
+
async function discoverResources() {
|
|
88
|
+
console.log("discovering resources")
|
|
89
|
+
// exploratory import. resources will emit to globalThis.wirejsResources
|
|
90
|
+
execSync(`cd api && npm run prebuild`);
|
|
91
|
+
await import(path.join(CWD, 'api', 'dist', 'index.js'));
|
|
128
92
|
console.log('discovered resources', globalThis.wirejsResources);
|
|
129
93
|
await fs.promises.writeFile(
|
|
130
94
|
path.join(BACKEND_DIR, 'generated-resources.ts'),
|
|
131
95
|
`export default ${JSON.stringify(globalThis.wirejsResources, null, 2)}`
|
|
132
96
|
);
|
|
133
|
-
|
|
134
|
-
return outputPath;
|
|
135
97
|
}
|
|
136
98
|
|
|
137
99
|
async function deployFrontend() {
|
|
@@ -164,7 +126,7 @@ if (action === 'prebuild') {
|
|
|
164
126
|
console.log("starting prebuild");
|
|
165
127
|
await createSkeleton();
|
|
166
128
|
await installDeps();
|
|
167
|
-
await
|
|
129
|
+
await discoverResources();
|
|
168
130
|
|
|
169
131
|
console.log("prebuild done");
|
|
170
132
|
} else if (action === 'inject-backend') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wirejs-deploy-amplify-basic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.116-realtime",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"recursive-copy": "^2.0.14",
|
|
42
42
|
"rimraf": "^6.0.1",
|
|
43
43
|
"wirejs-dom": "^1.0.41",
|
|
44
|
-
"wirejs-resources": "^0.1.
|
|
44
|
+
"wirejs-resources": "^0.1.84-realtime"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@aws-amplify/backend": "^1.14.0",
|