@linktr.ee/create-link-app 1.0.5 → 1.1.0

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
@@ -94,11 +94,10 @@ Start development server for Link App project
94
94
 
95
95
  ```
96
96
  USAGE
97
- $ create-link-app dev [-p <value>] [--https] [--host <value>]
97
+ $ create-link-app dev [-p <value>] [--https]
98
98
 
99
99
  FLAGS
100
100
  -p, --port=<value> [default: 3000] Development server listening port
101
- --host=<value> [default: localhost] Hostname
102
101
  --https Use HTTPS for development server
103
102
 
104
103
  DESCRIPTION
@@ -18,9 +18,7 @@ class Dev extends base_1.default {
18
18
  },
19
19
  hot: false,
20
20
  https: flags.https,
21
- host: flags.host,
22
21
  port: flags.port,
23
- allowedHosts: 'all',
24
22
  }, (0, webpack_1.default)(config));
25
23
  await devServer.start();
26
24
  }
@@ -37,8 +35,4 @@ Dev.flags = {
37
35
  https: core_1.Flags.boolean({
38
36
  description: 'Use HTTPS for development server',
39
37
  }),
40
- host: core_1.Flags.string({
41
- description: 'Hostname',
42
- default: 'localhost',
43
- }),
44
38
  };
@@ -7,21 +7,16 @@ exports.getPostcssConfig = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const tailwindcss_1 = __importDefault(require("tailwindcss"));
9
9
  const autoprefixer_1 = __importDefault(require("autoprefixer"));
10
- const componentLibraryContentPath = path_1.default.join(require.resolve('@linktr.ee/component-library/tailwind.config').split('/').slice(0, -1).join('/'), 'dist', '**', '*.js');
11
10
  const uiLinkKitPath = path_1.default.join(require.resolve('@linktr.ee/ui-link-kit').split('/').slice(0, -2).join('/'), '**', '*.js');
12
11
  function getPostcssConfig({ linkTypeSlug, env = 'production' }) {
13
12
  const isStorybook = env === 'storybook';
14
13
  const content = [`${process.cwd()}/src/**/*.{js,jsx,ts,tsx}`, uiLinkKitPath];
15
- if (isStorybook) {
16
- content.push(componentLibraryContentPath);
17
- }
18
14
  return {
19
15
  ...(isStorybook && { inject: { insertAtTop: true } }),
20
16
  plugins: [
21
17
  (0, tailwindcss_1.default)({
22
18
  important: `[data-link-type-id=${linkTypeSlug}]`,
23
19
  content,
24
- presets: [require('@linktr.ee/component-library/tailwind.config')],
25
20
  plugins: [],
26
21
  }),
27
22
  (0, autoprefixer_1.default)(),
@@ -27,10 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const react_1 = __importStar(require("react"));
30
- const react_dom_1 = __importDefault(require("react-dom"));
30
+ const client_1 = require("react-dom/client");
31
31
  const extension_1 = __importDefault(require("@linktr.ee/extension"));
32
32
  const extension_dev_data_1 = __importDefault(require("@linktr.ee/extension-dev-data"));
33
- const root = document.getElementById('root');
33
+ const container = document.getElementById('root');
34
+ const root = (0, client_1.createRoot)(container);
34
35
  const App = () => {
35
36
  // TODO: refactor common postMessage to parent in both entry points
36
37
  (0, react_1.useEffect)(() => {
@@ -38,7 +39,7 @@ const App = () => {
38
39
  type: 'extension-ready',
39
40
  data: {
40
41
  ready: true,
41
- height: root.clientHeight,
42
+ height: container.clientHeight,
42
43
  },
43
44
  };
44
45
  window.parent.postMessage(message, '*');
@@ -56,4 +57,4 @@ const App = () => {
56
57
  } }));
57
58
  }
58
59
  };
59
- react_dom_1.default.render(react_1.default.createElement(App, null), root);
60
+ root.render(react_1.default.createElement(App, null));
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
- const react_dom_1 = __importDefault(require("react-dom"));
7
+ const client_1 = require("react-dom/client");
8
8
  const extension_1 = __importDefault(require("@linktr.ee/extension"));
9
9
  const root = document.getElementById('root');
10
10
  // First set up event handler for extension data
@@ -24,7 +24,9 @@ window.parent.postMessage({ type: 'extension-loaded' }, '*');
24
24
  document.addEventListener('interaction-event', (event) => window.parent.postMessage({ type: 'interaction-event', data: event.detail }, '*'));
25
25
  const renderApp = (data) => {
26
26
  const App = () => react_1.default.createElement(extension_1.default, { ...data });
27
- react_dom_1.default.render(react_1.default.createElement(App, null), root, postExtensionReadyMessage);
27
+ const rootContainer = (0, client_1.createRoot)(root);
28
+ rootContainer.render(react_1.default.createElement(App, null));
29
+ postExtensionReadyMessage();
28
30
  };
29
31
  const postExtensionReadyMessage = () => {
30
32
  const message = {
@@ -11,6 +11,7 @@ const inject_body_webpack_plugin_1 = __importDefault(require("inject-body-webpac
11
11
  const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
12
12
  const path_1 = __importDefault(require("path"));
13
13
  const webpack_1 = require("webpack");
14
+ require("webpack-dev-server");
14
15
  const camelcase_1 = __importDefault(require("camelcase"));
15
16
  const slugify_1 = __importDefault(require("slugify"));
16
17
  const compile_1 = __importDefault(require("../lib/schema/compile"));
@@ -74,9 +75,15 @@ async function default_1(env, options) {
74
75
  },
75
76
  {
76
77
  test: /\.css$/,
78
+ include: [path_1.default.resolve(appDir, 'src'), /node_modules\/@linktr\.ee\/component-library/],
77
79
  use: [
78
80
  mini_css_extract_plugin_1.default.loader,
79
- 'css-loader',
81
+ {
82
+ loader: 'css-loader',
83
+ options: {
84
+ importLoaders: 1,
85
+ },
86
+ },
80
87
  {
81
88
  loader: 'postcss-loader',
82
89
  options: {
@@ -113,7 +120,10 @@ async function default_1(env, options) {
113
120
  ...config.resolve.alias,
114
121
  '@linktr.ee/extension-dev-data': path_1.default.resolve(appDir, 'fixtures', 'props-data.json'),
115
122
  };
116
- config.plugins.push(new mini_css_extract_plugin_1.default());
123
+ config.plugins.push(new mini_css_extract_plugin_1.default({
124
+ filename: '[name].[contenthash].css',
125
+ chunkFilename: '[id].[contenthash].css',
126
+ }));
117
127
  config.devServer = {
118
128
  host: '0.0.0.0',
119
129
  allowedHosts: 'all',
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.5",
2
+ "version": "1.1.0",
3
3
  "commands": {
4
4
  "build": {
5
5
  "id": "build",
@@ -9,6 +9,7 @@
9
9
  "pluginAlias": "@linktr.ee/create-link-app",
10
10
  "pluginType": "core",
11
11
  "aliases": [],
12
+ "hiddenAliases": [],
12
13
  "flags": {
13
14
  "allow-any-origin": {
14
15
  "name": "allow-any-origin",
@@ -34,6 +35,7 @@
34
35
  "pluginAlias": "@linktr.ee/create-link-app",
35
36
  "pluginType": "core",
36
37
  "aliases": [],
38
+ "hiddenAliases": [],
37
39
  "examples": [
38
40
  "$ create-link-app create my-link-app",
39
41
  "$ create-link-app create my-link-app --template react",
@@ -76,6 +78,7 @@
76
78
  "pluginAlias": "@linktr.ee/create-link-app",
77
79
  "pluginType": "core",
78
80
  "aliases": [],
81
+ "hiddenAliases": [],
79
82
  "flags": {
80
83
  "path": {
81
84
  "name": "path",
@@ -122,6 +125,7 @@
122
125
  "pluginAlias": "@linktr.ee/create-link-app",
123
126
  "pluginType": "core",
124
127
  "aliases": [],
128
+ "hiddenAliases": [],
125
129
  "examples": [
126
130
  "$ create-link-app dev",
127
131
  "$ create-link-app dev --port 8000",
@@ -141,13 +145,6 @@
141
145
  "type": "boolean",
142
146
  "description": "Use HTTPS for development server",
143
147
  "allowNo": false
144
- },
145
- "host": {
146
- "name": "host",
147
- "type": "option",
148
- "description": "Hostname",
149
- "multiple": false,
150
- "default": "localhost"
151
148
  }
152
149
  },
153
150
  "args": {}
@@ -160,6 +157,7 @@
160
157
  "pluginAlias": "@linktr.ee/create-link-app",
161
158
  "pluginType": "core",
162
159
  "aliases": [],
160
+ "hiddenAliases": [],
163
161
  "flags": {},
164
162
  "args": {}
165
163
  },
@@ -171,6 +169,7 @@
171
169
  "pluginAlias": "@linktr.ee/create-link-app",
172
170
  "pluginType": "core",
173
171
  "aliases": [],
172
+ "hiddenAliases": [],
174
173
  "examples": [
175
174
  "$ create-link-app grant-access my-link-app friend"
176
175
  ],
@@ -211,6 +210,7 @@
211
210
  "pluginAlias": "@linktr.ee/create-link-app",
212
211
  "pluginType": "core",
213
212
  "aliases": [],
213
+ "hiddenAliases": [],
214
214
  "flags": {
215
215
  "qa": {
216
216
  "name": "qa",
@@ -230,6 +230,7 @@
230
230
  "pluginAlias": "@linktr.ee/create-link-app",
231
231
  "pluginType": "core",
232
232
  "aliases": [],
233
+ "hiddenAliases": [],
233
234
  "flags": {
234
235
  "qa": {
235
236
  "name": "qa",
@@ -249,6 +250,7 @@
249
250
  "pluginAlias": "@linktr.ee/create-link-app",
250
251
  "pluginType": "core",
251
252
  "aliases": [],
253
+ "hiddenAliases": [],
252
254
  "flags": {
253
255
  "port": {
254
256
  "name": "port",
package/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "@linktr.ee/create-link-app",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "Create a Link App on Linktr.ee.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Linktree",
7
7
  "engines": {
8
- "node": ">=12.0.0"
9
- },
10
- "bin": {
11
- "create-link-app": "./bin/run"
8
+ "node": ">=18.0.0"
12
9
  },
10
+ "bin": "./bin/run",
13
11
  "files": [
14
12
  "/bin",
15
13
  "/dist",
@@ -35,7 +33,6 @@
35
33
  "@babel/preset-react": "^7.17.12",
36
34
  "@babel/preset-typescript": "^7.17.12",
37
35
  "@babel/runtime": "^7.18.3",
38
- "@linktr.ee/component-library": "latest",
39
36
  "@linktr.ee/ui-link-kit": "latest",
40
37
  "@oclif/core": "^1.9.0",
41
38
  "@oclif/plugin-help": "5.1.23",
@@ -95,6 +92,7 @@
95
92
  "@types/react": "^18.2.20",
96
93
  "@types/react-dom": "^18.2.7",
97
94
  "axios-mock-adapter": "^1.21.1",
95
+ "babel-jest": "^29.7.0",
98
96
  "jest": "^28.1.1",
99
97
  "oclif": "^3.0.1",
100
98
  "shx": "^0.3.4",