@linktr.ee/create-link-app 0.3.0-next.35 → 0.3.0-next.37

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.
@@ -3,19 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getPostcssConfig = void 0;
6
7
  const path_1 = __importDefault(require("path"));
7
8
  const tailwindcss_1 = __importDefault(require("tailwindcss"));
8
9
  const autoprefixer_1 = __importDefault(require("autoprefixer"));
9
10
  const componentLibraryContentPath = path_1.default.join(require.resolve('@linktr.ee/component-library/tailwind.config').split('/').slice(0, -1).join('/'), 'dist', '**', '*.js');
10
11
  const uiLinkKitPath = path_1.default.join(require.resolve('@linktr.ee/ui-link-kit').split('/').slice(0, -2).join('/'), '**', '*.js');
11
- const config = {
12
- plugins: [
13
- (0, tailwindcss_1.default)({
14
- content: [`${process.cwd()}/src/**/*.{js,jsx,ts,tsx}`, componentLibraryContentPath, uiLinkKitPath],
15
- presets: [require('@linktr.ee/component-library/tailwind.config')],
16
- plugins: [],
17
- }),
18
- (0, autoprefixer_1.default)(),
19
- ],
20
- };
21
- module.exports = config;
12
+ function getPostcssConfig({ linkTypeSlug, env = 'production' }) {
13
+ const isStorybook = env === 'storybook';
14
+ const content = [`${process.cwd()}/src/**/*.{js,jsx,ts,tsx}`, uiLinkKitPath];
15
+ if (isStorybook) {
16
+ content.push(componentLibraryContentPath);
17
+ }
18
+ return {
19
+ ...(isStorybook && { inject: { insertAtTop: true } }),
20
+ plugins: [
21
+ (0, tailwindcss_1.default)({
22
+ important: `[data-link-type-id=${linkTypeSlug}]`,
23
+ content,
24
+ presets: [require('@linktr.ee/component-library/tailwind.config')],
25
+ plugins: [],
26
+ }),
27
+ (0, autoprefixer_1.default)(),
28
+ ],
29
+ };
30
+ }
31
+ exports.getPostcssConfig = getPostcssConfig;
@@ -1,33 +1,14 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  const postcss_1 = __importDefault(require("postcss"));
30
- const postcssOptions = __importStar(require("../postcss/postcss.config"));
7
+ const webpack_1 = __importDefault(require("webpack"));
8
+ const postcss_config_1 = require("../postcss/postcss.config");
9
+ // Do not need to be the real values, just need to be defined for storybook
10
+ const linkTypeSlug = 'test-id';
11
+ const linkTypeId = 'testId';
31
12
  const config = {
32
13
  stories: [`${process.cwd()}/src/**/*.stories.@(js|jsx|ts|tsx)`],
33
14
  addons: [
@@ -49,7 +30,7 @@ const config = {
49
30
  cssLoaderOptions: { importLoaders: 1 },
50
31
  postcssLoaderOptions: {
51
32
  implementation: postcss_1.default,
52
- postcssOptions: { ...postcssOptions },
33
+ postcssOptions: (0, postcss_config_1.getPostcssConfig)({ linkTypeSlug, env: 'storybook' }),
53
34
  },
54
35
  },
55
36
  },
@@ -58,5 +39,15 @@ const config = {
58
39
  core: {
59
40
  builder: 'webpack5',
60
41
  },
42
+ webpackFinal: async (config) => {
43
+ if (config.plugins?.length) {
44
+ // Add the DefinePlugin to the Webpack plugins array
45
+ config.plugins.push(new webpack_1.default.DefinePlugin({
46
+ __LINK_TYPE_ID__: JSON.stringify(linkTypeId),
47
+ __LINK_TYPE_SLUG__: JSON.stringify(linkTypeSlug),
48
+ }));
49
+ }
50
+ return config;
51
+ },
61
52
  };
62
53
  module.exports = config;
@@ -1,28 +1,5 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
27
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
5
  };
@@ -37,7 +14,7 @@ const webpack_1 = require("webpack");
37
14
  const camelcase_1 = __importDefault(require("camelcase"));
38
15
  const slugify_1 = __importDefault(require("slugify"));
39
16
  const compile_1 = __importDefault(require("../lib/schema/compile"));
40
- const postcssOptions = __importStar(require("../postcss/postcss.config"));
17
+ const postcss_config_1 = require("../postcss/postcss.config");
41
18
  const { ModuleFederationPlugin } = webpack_1.container;
42
19
  function toVirtualModule(code) {
43
20
  const base64 = Buffer.from(code).toString('base64');
@@ -103,7 +80,7 @@ async function default_1(env, options) {
103
80
  {
104
81
  loader: 'postcss-loader',
105
82
  options: {
106
- postcssOptions: { ...postcssOptions },
83
+ postcssOptions: { ...(0, postcss_config_1.getPostcssConfig)({ linkTypeSlug }) },
107
84
  },
108
85
  },
109
86
  ],
@@ -164,6 +141,8 @@ async function default_1(env, options) {
164
141
  };
165
142
  config.plugins.push(new webpack_1.DefinePlugin({
166
143
  __ALLOW_ANY_ORIGIN__: options?.allowAnyOrigin,
144
+ __LINK_TYPE_SLUG__: JSON.stringify(linkTypeSlug),
145
+ __LINK_TYPE_ID__: JSON.stringify(linkTypeId),
167
146
  }),
168
147
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
169
148
  // @ts-ignore
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.0-next.35",
2
+ "version": "0.3.0-next.37",
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.3.0-next.35",
3
+ "version": "0.3.0-next.37",
4
4
  "description": "Create a Link App on Linktr.ee.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Linktree",
@@ -35,7 +35,7 @@
35
35
  "@babel/preset-react": "^7.17.12",
36
36
  "@babel/preset-typescript": "^7.17.12",
37
37
  "@babel/runtime": "^7.18.3",
38
- "@linktr.ee/component-library": "^7.0.17",
38
+ "@linktr.ee/component-library": "latest",
39
39
  "@linktr.ee/ui-link-kit": "latest",
40
40
  "@oclif/core": "^1.9.0",
41
41
  "@oclif/plugin-help": "^5.1.12",
@@ -43,7 +43,13 @@ const Grid = (props: AppProps) => {
43
43
 
44
44
  const Stack = (props: AppProps) => {
45
45
  return (
46
- <div className="flex p-2 h-full gap-4 w-full" style={{ ...baseStyle, borderRadius: 'var(--lt-stack-container-radius)' }}>
46
+ <div
47
+ className="flex p-2 h-full gap-4 w-full"
48
+ style={{
49
+ ...baseStyle,
50
+ borderRadius: 'var(--lt-stack-container-radius)',
51
+ }}
52
+ >
47
53
  <div className="w-16 aspect-square"></div>
48
54
  <h2 className="mr-20">Stack</h2>
49
55
  </div>
@@ -31,8 +31,9 @@ export default {
31
31
 
32
32
  export const Stack: ComponentStory<typeof LinkApp> = (args) => (
33
33
  <div
34
- className="m-2"
34
+ data-link-type-id={__LINK_TYPE_SLUG__}
35
35
  style={{
36
+ margin: '0.5rem',
36
37
  width: 374,
37
38
  height: 80,
38
39
  }}
@@ -46,8 +47,9 @@ Stack.args = {
46
47
 
47
48
  export const Grid: ComponentStory<typeof LinkApp> = (args) => (
48
49
  <div
49
- className="m-2"
50
+ data-link-type-id={__LINK_TYPE_SLUG__}
50
51
  style={{
52
+ margin: '0.5rem',
51
53
  width: 183,
52
54
  height: 240,
53
55
  }}
@@ -61,8 +63,9 @@ Grid.args = {
61
63
 
62
64
  export const Carousel: ComponentStory<typeof LinkApp> = (args) => (
63
65
  <div
64
- className="m-2"
66
+ data-link-type-id={__LINK_TYPE_SLUG__}
65
67
  style={{
68
+ margin: '0.5rem',
66
69
  width: 224,
67
70
  height: 296,
68
71
  }}
@@ -76,8 +79,9 @@ Carousel.args = {
76
79
 
77
80
  export const Featured: ComponentStory<typeof LinkApp> = (args) => (
78
81
  <div
79
- className="m-2"
82
+ data-link-type-id={__LINK_TYPE_SLUG__}
80
83
  style={{
84
+ margin: '0.5rem',
81
85
  width: 374,
82
86
  height: 374,
83
87
  }}
@@ -6,3 +6,6 @@ declare module '*manifest.json' {
6
6
  declare module '*props-data.json' {
7
7
  export const name: string
8
8
  }
9
+
10
+ declare const __LINK_TYPE_ID__: string
11
+ declare const __LINK_TYPE_SLUG__: string