@linktr.ee/create-link-app 0.2.2 → 0.3.0-next.1

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/README.md CHANGED
@@ -24,7 +24,7 @@ yarn create @linktr.ee/create-link-app my-link-app
24
24
  * [`create-link-app deploy`](#create-link-app-deploy)
25
25
  * [`create-link-app dev`](#create-link-app-dev)
26
26
  * [`create-link-app grant-access LINK_APP_ID USERNAME`](#create-link-app-grant-access-link_app_id-username)
27
- * [`create-link-app help [COMMAND]`](#create-link-app-help-command)
27
+ * [`create-link-app help [COMMANDS]`](#create-link-app-help-commands)
28
28
  * [`create-link-app login`](#create-link-app-login)
29
29
  * [`create-link-app logout`](#create-link-app-logout)
30
30
 
@@ -125,16 +125,16 @@ EXAMPLES
125
125
  $ create-link-app grant-access my-link-app friend
126
126
  ```
127
127
 
128
- ## `create-link-app help [COMMAND]`
128
+ ## `create-link-app help [COMMANDS]`
129
129
 
130
130
  Display help for create-link-app.
131
131
 
132
132
  ```
133
133
  USAGE
134
- $ create-link-app help [COMMAND] [-n]
134
+ $ create-link-app help [COMMANDS] [-n]
135
135
 
136
136
  ARGUMENTS
137
- COMMAND Command to show help for.
137
+ COMMANDS Command to show help for.
138
138
 
139
139
  FLAGS
140
140
  -n, --nested-commands Include all nested commands in the output.
@@ -143,7 +143,7 @@ DESCRIPTION
143
143
  Display help for create-link-app.
144
144
  ```
145
145
 
146
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.23/src/commands/help.ts)_
146
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.9/src/commands/help.ts)_
147
147
 
148
148
  ## `create-link-app login`
149
149
 
@@ -12,6 +12,11 @@ const RequiredAssets = [
12
12
  fileName: 'manifest.json',
13
13
  contentType: 'application/json',
14
14
  },
15
+ {
16
+ key: 'settings',
17
+ fileName: 'settings.json',
18
+ contentType: 'application/json',
19
+ },
15
20
  {
16
21
  key: 'package',
17
22
  fileName: 'package.tgz',
@@ -24,11 +29,6 @@ const OptionalAssets = [
24
29
  fileName: 'icon.svg',
25
30
  contentType: 'image/svg+xml',
26
31
  },
27
- {
28
- key: 'settings',
29
- fileName: 'settings.json',
30
- contentType: 'application/json',
31
- },
32
32
  {
33
33
  key: 'url_match_rules',
34
34
  fileName: 'url_match_rules.json',
@@ -31,9 +31,9 @@ async function packProject() {
31
31
  });
32
32
  archive.on('warning', (err) => {
33
33
  if (err.code === 'ENOENT') {
34
- // package, lock files and tsconfig may or may not exist
34
+ // lock files and tsconfig may or may not exist
35
35
  const fileName = path_1.default.basename(err.path);
36
- if (fileName === 'package.json' || fileName === 'package-lock.json' || fileName === 'yarn.lock' || fileName === 'tsconfig.json') {
36
+ if (fileName === 'package-lock.json' || fileName === 'yarn.lock' || fileName === 'tsconfig.json') {
37
37
  return;
38
38
  }
39
39
  }
@@ -10,10 +10,16 @@ const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
10
10
  const inject_body_webpack_plugin_1 = __importDefault(require("inject-body-webpack-plugin"));
11
11
  const path_1 = __importDefault(require("path"));
12
12
  const webpack_1 = require("webpack");
13
+ const camelcase_1 = __importDefault(require("camelcase"));
14
+ const slugify_1 = __importDefault(require("slugify"));
15
+ const { ModuleFederationPlugin } = webpack_1.container;
13
16
  function default_1(env, options) {
14
17
  const appDir = process.cwd();
15
18
  const entryFile = path_1.default.resolve(__dirname, `${env}.entry`);
16
19
  const htmlTemplateFile = path_1.default.resolve(__dirname, '..', '..', 'html-template', `${env}.html`);
20
+ const manifestJson = JSON.parse(fs_1.default.readFileSync(path_1.default.resolve(appDir, 'manifest.json'), 'utf8'));
21
+ const linkTypeName = manifestJson.name.replace(/[^A-Za-z0-9 ]/g, '');
22
+ const linkTypeId = (0, camelcase_1.default)((0, slugify_1.default)(linkTypeName, { lower: true }), { pascalCase: true });
17
23
  const hasTsconfig = fileExists(path_1.default.resolve(appDir, 'tsconfig.json'));
18
24
  const config = {
19
25
  target: 'web',
@@ -57,6 +63,7 @@ function default_1(env, options) {
57
63
  plugins: [
58
64
  new html_webpack_plugin_1.default({
59
65
  template: htmlTemplateFile,
66
+ excludeChunks: [`LinkApp_${linkTypeId}`],
60
67
  }),
61
68
  ],
62
69
  };
@@ -90,6 +97,26 @@ function default_1(env, options) {
90
97
  new inject_body_webpack_plugin_1.default({
91
98
  position: 'start',
92
99
  content: `<!-- ${getBuildInfo()} -->`,
100
+ }), new ModuleFederationPlugin({
101
+ name: `LinkApp_${linkTypeId}`,
102
+ filename: 'remoteEntry.js',
103
+ exposes: {
104
+ [`LinkApp_${linkTypeId}`]: path_1.default.resolve(appDir, 'src'),
105
+ },
106
+ shared: {
107
+ react: {
108
+ singleton: true,
109
+ requiredVersion: '17 || 18',
110
+ },
111
+ 'react-dom': {
112
+ singleton: true,
113
+ requiredVersion: '17 || 18',
114
+ },
115
+ 'styled-components': {
116
+ singleton: true,
117
+ requiredVersion: '5',
118
+ },
119
+ },
93
120
  }));
94
121
  }
95
122
  return config;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.2",
2
+ "version": "0.3.0-next.1",
3
3
  "commands": {
4
4
  "build": {
5
5
  "id": "build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/create-link-app",
3
- "version": "0.2.2",
3
+ "version": "0.3.0-next.1",
4
4
  "description": "Create a Link App on Linktr.ee.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Linktree",
@@ -39,6 +39,7 @@
39
39
  "archiver": "^5.3.1",
40
40
  "axios": "^0.27.2",
41
41
  "babel-loader": "^8.2.5",
42
+ "camelcase": "^6.3.0",
42
43
  "fork-ts-checker-webpack-plugin": "^7.2.11",
43
44
  "form-data": "^4.0.0",
44
45
  "fs-extra": "^10.1.0",
@@ -49,6 +50,7 @@
49
50
  "openid-client": "^5.1.6",
50
51
  "react": "^17.0.2",
51
52
  "react-dom": "^17.0.2",
53
+ "slugify": "^1.6.6",
52
54
  "styled-components": "^5.3.5",
53
55
  "typescript": "^4.7.3",
54
56
  "webpack": "^5.75.0",