@linktr.ee/create-link-app 1.0.4 → 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.
@@ -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,10 +120,13 @@ 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 = {
128
+ host: '0.0.0.0',
118
129
  allowedHosts: 'all',
119
- historyApiFallback: true,
120
130
  };
121
131
  }
122
132
  if (env === 'production') {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.4",
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",
@@ -153,6 +157,7 @@
153
157
  "pluginAlias": "@linktr.ee/create-link-app",
154
158
  "pluginType": "core",
155
159
  "aliases": [],
160
+ "hiddenAliases": [],
156
161
  "flags": {},
157
162
  "args": {}
158
163
  },
@@ -164,6 +169,7 @@
164
169
  "pluginAlias": "@linktr.ee/create-link-app",
165
170
  "pluginType": "core",
166
171
  "aliases": [],
172
+ "hiddenAliases": [],
167
173
  "examples": [
168
174
  "$ create-link-app grant-access my-link-app friend"
169
175
  ],
@@ -204,6 +210,7 @@
204
210
  "pluginAlias": "@linktr.ee/create-link-app",
205
211
  "pluginType": "core",
206
212
  "aliases": [],
213
+ "hiddenAliases": [],
207
214
  "flags": {
208
215
  "qa": {
209
216
  "name": "qa",
@@ -223,6 +230,7 @@
223
230
  "pluginAlias": "@linktr.ee/create-link-app",
224
231
  "pluginType": "core",
225
232
  "aliases": [],
233
+ "hiddenAliases": [],
226
234
  "flags": {
227
235
  "qa": {
228
236
  "name": "qa",
@@ -242,6 +250,7 @@
242
250
  "pluginAlias": "@linktr.ee/create-link-app",
243
251
  "pluginType": "core",
244
252
  "aliases": [],
253
+ "hiddenAliases": [],
245
254
  "flags": {
246
255
  "port": {
247
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.4",
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",