@sproutsocial/racine 11.2.3 → 11.2.5-sproutTheme-beta.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/CHANGELOG.md +12 -0
- package/__flow__/Link/index.js +2 -1
- package/__flow__/ThemeProvider/index.js +1 -1
- package/__flow__/index.js +4 -0
- package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +44 -0
- package/__flow__/themes/extendedThemes/sproutTheme/index.js +2 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +44 -0
- package/__flow__/types/theme.flow.js +2 -0
- package/commonjs/index.js +8 -1
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +48 -0
- package/commonjs/themes/extendedThemes/sproutTheme/index.js +14 -0
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +48 -0
- package/lib/index.js +1 -0
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +40 -0
- package/lib/themes/extendedThemes/sproutTheme/index.js +2 -0
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +40 -0
- package/package.json +2 -1
- package/bin/buildNpm.js +0 -58
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 11.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a73cdfb: remove weird characters from props descriptions
|
|
8
|
+
|
|
9
|
+
## 11.2.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 206bd32: copy updates to the TypeProps comments that power Seeds prop tables
|
|
14
|
+
|
|
3
15
|
## 11.2.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/__flow__/Link/index.js
CHANGED
|
@@ -8,10 +8,11 @@ type TypeProps = {
|
|
|
8
8
|
/** Optional prop to make the URL open in a new tab */
|
|
9
9
|
external?: boolean,
|
|
10
10
|
children: React.Node,
|
|
11
|
+
/** Setting this prop will cause the component to be rendered as a link */
|
|
11
12
|
href?: string,
|
|
12
13
|
/** Disables user action and applies a disabled style to the component */
|
|
13
14
|
disabled?: boolean,
|
|
14
|
-
/**
|
|
15
|
+
/** Can be used in addition to an href but still renders as a link. Omitting href will render as button */
|
|
15
16
|
onClick?: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
16
17
|
as?: $PropertyType<TypeStyledComponentsCommonProps, "as">,
|
|
17
18
|
underline?: boolean,
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { ThemeProvider as BaseThemeProvider } from "styled-components";
|
|
4
4
|
import theme from "../themes/light/theme";
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import type { TypeTheme } from "../types/theme.flow";
|
|
7
7
|
|
|
8
8
|
type TypeProps = $ReadOnly<{|
|
|
9
9
|
theme?: TypeTheme,
|
package/__flow__/index.js
CHANGED
|
@@ -6,6 +6,10 @@ export { visuallyHidden, focusRing, disabled } from "./utils/mixins";
|
|
|
6
6
|
export { useSelect, useMultiselect, useTextContent } from "./utils/hooks";
|
|
7
7
|
export { default as theme } from "./themes/light/theme";
|
|
8
8
|
export { default as darkTheme } from "./themes/dark/theme";
|
|
9
|
+
export {
|
|
10
|
+
sproutLightTheme,
|
|
11
|
+
sproutDarkTheme,
|
|
12
|
+
} from "./themes/extendedThemes/sproutTheme";
|
|
9
13
|
export { default as Icon } from "./Icon";
|
|
10
14
|
// DEPRECATED: Alert has been renamed to Banner
|
|
11
15
|
export { default as Alert } from "./Banner";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import clone from "just-clone";
|
|
3
|
+
import type { TypeTheme } from "../../../../types/theme.flow.js";
|
|
4
|
+
|
|
5
|
+
const darkTheme = (theme: TypeTheme) => {
|
|
6
|
+
const sproutDarkTheme = clone(theme);
|
|
7
|
+
|
|
8
|
+
sproutDarkTheme.sprout = {
|
|
9
|
+
colors: {
|
|
10
|
+
navigation: {
|
|
11
|
+
main: {
|
|
12
|
+
background: {
|
|
13
|
+
base: theme.colors.neutral[1000],
|
|
14
|
+
gradient: theme.colors.neutral[1100],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
secondary: {
|
|
18
|
+
background: {
|
|
19
|
+
base: theme.colors.neutral[900],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
text: {
|
|
23
|
+
base: theme.colors.neutral[0],
|
|
24
|
+
hover: theme.colors.neutral[0],
|
|
25
|
+
},
|
|
26
|
+
icon: {
|
|
27
|
+
base: theme.colors.neutral[0],
|
|
28
|
+
hover: theme.colors.neutral[0],
|
|
29
|
+
},
|
|
30
|
+
item: {
|
|
31
|
+
background: {
|
|
32
|
+
base: theme.colors.neutral[1000],
|
|
33
|
+
hover: theme.colors.neutral[1100],
|
|
34
|
+
active: theme.colors.neutral[700],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return sproutDarkTheme;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default darkTheme;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import clone from "just-clone";
|
|
3
|
+
import type { TypeTheme } from "../../../../types/theme.flow.js";
|
|
4
|
+
|
|
5
|
+
const lightTheme = (theme: TypeTheme) => {
|
|
6
|
+
const sproutLightTheme = clone(theme);
|
|
7
|
+
|
|
8
|
+
sproutLightTheme.sprout = {
|
|
9
|
+
colors: {
|
|
10
|
+
navigation: {
|
|
11
|
+
main: {
|
|
12
|
+
background: {
|
|
13
|
+
base: theme.colors.neutral[900],
|
|
14
|
+
gradient: theme.colors.neutral[1000],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
secondary: {
|
|
18
|
+
background: {
|
|
19
|
+
base: theme.colors.neutral[800],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
text: {
|
|
23
|
+
base: theme.colors.neutral[0],
|
|
24
|
+
hover: theme.colors.neutral[0],
|
|
25
|
+
},
|
|
26
|
+
icon: {
|
|
27
|
+
base: theme.colors.neutral[0],
|
|
28
|
+
hover: theme.colors.neutral[0],
|
|
29
|
+
},
|
|
30
|
+
item: {
|
|
31
|
+
background: {
|
|
32
|
+
base: theme.colors.neutral[800],
|
|
33
|
+
hover: theme.colors.neutral[1000],
|
|
34
|
+
active: theme.colors.neutral[700],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return sproutLightTheme;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default lightTheme;
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import type { TypeColors } from "./theme.colors.flow.js";
|
|
15
15
|
import type { TypeFontFamilyString } from "../themes/light/theme";
|
|
16
16
|
|
|
17
|
+
export type TypeThemeMode = "light" | "dark";
|
|
17
18
|
export type TypeBreakpoint = typeof breakpoints;
|
|
18
19
|
export type TypeTypography = typeof typography;
|
|
19
20
|
export type TypeFontWeight = typeof fontWeights;
|
|
@@ -28,6 +29,7 @@ export type TypeEasing = typeof easing;
|
|
|
28
29
|
export type TypeDuration = typeof duration;
|
|
29
30
|
|
|
30
31
|
export type TypeTheme = {
|
|
32
|
+
mode: TypeThemeMode,
|
|
31
33
|
breakpoints: TypeBreakpoint,
|
|
32
34
|
colors: TypeColor,
|
|
33
35
|
typography: TypeTypography,
|
package/commonjs/index.js
CHANGED
|
@@ -61,6 +61,8 @@ var _exportNames = {
|
|
|
61
61
|
Menu: true,
|
|
62
62
|
Listbox: true,
|
|
63
63
|
OverflowList: true,
|
|
64
|
+
sproutLightTheme: true,
|
|
65
|
+
sproutDarkTheme: true,
|
|
64
66
|
toast: true,
|
|
65
67
|
MenuButton: true,
|
|
66
68
|
MenuButtonContext: true,
|
|
@@ -70,7 +72,7 @@ var _exportNames = {
|
|
|
70
72
|
DateRangePicker: true,
|
|
71
73
|
VisuallyHidden: true
|
|
72
74
|
};
|
|
73
|
-
exports.VisuallyHidden = exports.DateRangePicker = exports.SingleDatePicker = exports.ListboxButton = exports.MenuItemContainer = exports.MenuButtonContext = exports.MenuButton = exports.toast = exports.OverflowList = exports.Listbox = exports.Menu = exports.ToastContainer = exports.Skeleton = exports.Breadcrumb = exports.Avatar = exports.Stack = exports.Message = exports.Fieldset = exports.FormField = exports.EmptyState = exports.SegmentedControl = exports.Collapsible = exports.Numeral = exports.LoaderButton = exports.Drawer = exports.Tooltip = exports.ThemeProvider = exports.Popout = exports.Modal = exports.Tabs = exports.TokenInput = exports.Token = exports.Switch = exports.Link = exports.Button = exports.Select = exports.Input = exports.Label = exports.Box = exports.TableRowAccordion = exports.TableHeaderCell = exports.TableCell = exports.Table = exports.ChartLegend = exports.KeyboardKey = exports.Image = exports.Text = exports.Loader = exports.ToggleHint = exports.Textarea = exports.Radio = exports.Checkbox = exports.CharacterCounter = exports.Card = exports.Indicator = exports.Badge = exports.Banner = exports.Alert = exports.Icon = exports.darkTheme = exports.theme = exports.useTextContent = exports.useMultiselect = exports.useSelect = exports.disabled = exports.focusRing = exports.visuallyHidden = void 0;
|
|
75
|
+
exports.VisuallyHidden = exports.DateRangePicker = exports.SingleDatePicker = exports.ListboxButton = exports.MenuItemContainer = exports.MenuButtonContext = exports.MenuButton = exports.toast = exports.sproutDarkTheme = exports.sproutLightTheme = exports.OverflowList = exports.Listbox = exports.Menu = exports.ToastContainer = exports.Skeleton = exports.Breadcrumb = exports.Avatar = exports.Stack = exports.Message = exports.Fieldset = exports.FormField = exports.EmptyState = exports.SegmentedControl = exports.Collapsible = exports.Numeral = exports.LoaderButton = exports.Drawer = exports.Tooltip = exports.ThemeProvider = exports.Popout = exports.Modal = exports.Tabs = exports.TokenInput = exports.Token = exports.Switch = exports.Link = exports.Button = exports.Select = exports.Input = exports.Label = exports.Box = exports.TableRowAccordion = exports.TableHeaderCell = exports.TableCell = exports.Table = exports.ChartLegend = exports.KeyboardKey = exports.Image = exports.Text = exports.Loader = exports.ToggleHint = exports.Textarea = exports.Radio = exports.Checkbox = exports.CharacterCounter = exports.Card = exports.Indicator = exports.Badge = exports.Banner = exports.Alert = exports.Icon = exports.darkTheme = exports.theme = exports.useTextContent = exports.useMultiselect = exports.useSelect = exports.disabled = exports.focusRing = exports.visuallyHidden = void 0;
|
|
74
76
|
|
|
75
77
|
var _systemProps = require("./systemProps");
|
|
76
78
|
|
|
@@ -101,6 +103,11 @@ var _theme2 = _interopRequireDefault(require("./themes/dark/theme"));
|
|
|
101
103
|
|
|
102
104
|
exports.darkTheme = _theme2.default;
|
|
103
105
|
|
|
106
|
+
var _sproutTheme = require("./themes/extendedThemes/sproutTheme");
|
|
107
|
+
|
|
108
|
+
exports.sproutLightTheme = _sproutTheme.sproutLightTheme;
|
|
109
|
+
exports.sproutDarkTheme = _sproutTheme.sproutDarkTheme;
|
|
110
|
+
|
|
104
111
|
var _Icon = _interopRequireDefault(require("./Icon"));
|
|
105
112
|
|
|
106
113
|
exports.Icon = _Icon.default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _justClone = _interopRequireDefault(require("just-clone"));
|
|
7
|
+
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
|
|
10
|
+
var darkTheme = function darkTheme(theme) {
|
|
11
|
+
var sproutDarkTheme = (0, _justClone.default)(theme);
|
|
12
|
+
sproutDarkTheme.sprout = {
|
|
13
|
+
colors: {
|
|
14
|
+
navigation: {
|
|
15
|
+
main: {
|
|
16
|
+
background: {
|
|
17
|
+
base: theme.colors.neutral[1000],
|
|
18
|
+
gradient: theme.colors.neutral[1100]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
secondary: {
|
|
22
|
+
background: {
|
|
23
|
+
base: theme.colors.neutral[900]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
text: {
|
|
27
|
+
base: theme.colors.neutral[0],
|
|
28
|
+
hover: theme.colors.neutral[0]
|
|
29
|
+
},
|
|
30
|
+
icon: {
|
|
31
|
+
base: theme.colors.neutral[0],
|
|
32
|
+
hover: theme.colors.neutral[0]
|
|
33
|
+
},
|
|
34
|
+
item: {
|
|
35
|
+
background: {
|
|
36
|
+
base: theme.colors.neutral[1000],
|
|
37
|
+
hover: theme.colors.neutral[1100],
|
|
38
|
+
active: theme.colors.neutral[700]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return sproutDarkTheme;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var _default = darkTheme;
|
|
48
|
+
exports.default = _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.sproutDarkTheme = exports.sproutLightTheme = void 0;
|
|
5
|
+
|
|
6
|
+
var _theme = _interopRequireDefault(require("./light/theme"));
|
|
7
|
+
|
|
8
|
+
exports.sproutLightTheme = _theme.default;
|
|
9
|
+
|
|
10
|
+
var _theme2 = _interopRequireDefault(require("./dark/theme"));
|
|
11
|
+
|
|
12
|
+
exports.sproutDarkTheme = _theme2.default;
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _justClone = _interopRequireDefault(require("just-clone"));
|
|
7
|
+
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
|
|
10
|
+
var lightTheme = function lightTheme(theme) {
|
|
11
|
+
var sproutLightTheme = (0, _justClone.default)(theme);
|
|
12
|
+
sproutLightTheme.sprout = {
|
|
13
|
+
colors: {
|
|
14
|
+
navigation: {
|
|
15
|
+
main: {
|
|
16
|
+
background: {
|
|
17
|
+
base: theme.colors.neutral[900],
|
|
18
|
+
gradient: theme.colors.neutral[1000]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
secondary: {
|
|
22
|
+
background: {
|
|
23
|
+
base: theme.colors.neutral[800]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
text: {
|
|
27
|
+
base: theme.colors.neutral[0],
|
|
28
|
+
hover: theme.colors.neutral[0]
|
|
29
|
+
},
|
|
30
|
+
icon: {
|
|
31
|
+
base: theme.colors.neutral[0],
|
|
32
|
+
hover: theme.colors.neutral[0]
|
|
33
|
+
},
|
|
34
|
+
item: {
|
|
35
|
+
background: {
|
|
36
|
+
base: theme.colors.neutral[800],
|
|
37
|
+
hover: theme.colors.neutral[1000],
|
|
38
|
+
active: theme.colors.neutral[700]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return sproutLightTheme;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var _default = lightTheme;
|
|
48
|
+
exports.default = _default;
|
package/lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { visuallyHidden, focusRing, disabled } from "./utils/mixins";
|
|
|
3
3
|
export { useSelect, useMultiselect, useTextContent } from "./utils/hooks";
|
|
4
4
|
export { default as theme } from "./themes/light/theme";
|
|
5
5
|
export { default as darkTheme } from "./themes/dark/theme";
|
|
6
|
+
export { sproutLightTheme, sproutDarkTheme } from "./themes/extendedThemes/sproutTheme";
|
|
6
7
|
export { default as Icon } from "./Icon"; // DEPRECATED: Alert has been renamed to Banner
|
|
7
8
|
|
|
8
9
|
export { default as Alert } from "./Banner";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import clone from "just-clone";
|
|
2
|
+
|
|
3
|
+
var darkTheme = function darkTheme(theme) {
|
|
4
|
+
var sproutDarkTheme = clone(theme);
|
|
5
|
+
sproutDarkTheme.sprout = {
|
|
6
|
+
colors: {
|
|
7
|
+
navigation: {
|
|
8
|
+
main: {
|
|
9
|
+
background: {
|
|
10
|
+
base: theme.colors.neutral[1000],
|
|
11
|
+
gradient: theme.colors.neutral[1100]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
secondary: {
|
|
15
|
+
background: {
|
|
16
|
+
base: theme.colors.neutral[900]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
text: {
|
|
20
|
+
base: theme.colors.neutral[0],
|
|
21
|
+
hover: theme.colors.neutral[0]
|
|
22
|
+
},
|
|
23
|
+
icon: {
|
|
24
|
+
base: theme.colors.neutral[0],
|
|
25
|
+
hover: theme.colors.neutral[0]
|
|
26
|
+
},
|
|
27
|
+
item: {
|
|
28
|
+
background: {
|
|
29
|
+
base: theme.colors.neutral[1000],
|
|
30
|
+
hover: theme.colors.neutral[1100],
|
|
31
|
+
active: theme.colors.neutral[700]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return sproutDarkTheme;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default darkTheme;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import clone from "just-clone";
|
|
2
|
+
|
|
3
|
+
var lightTheme = function lightTheme(theme) {
|
|
4
|
+
var sproutLightTheme = clone(theme);
|
|
5
|
+
sproutLightTheme.sprout = {
|
|
6
|
+
colors: {
|
|
7
|
+
navigation: {
|
|
8
|
+
main: {
|
|
9
|
+
background: {
|
|
10
|
+
base: theme.colors.neutral[900],
|
|
11
|
+
gradient: theme.colors.neutral[1000]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
secondary: {
|
|
15
|
+
background: {
|
|
16
|
+
base: theme.colors.neutral[800]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
text: {
|
|
20
|
+
base: theme.colors.neutral[0],
|
|
21
|
+
hover: theme.colors.neutral[0]
|
|
22
|
+
},
|
|
23
|
+
icon: {
|
|
24
|
+
base: theme.colors.neutral[0],
|
|
25
|
+
hover: theme.colors.neutral[0]
|
|
26
|
+
},
|
|
27
|
+
item: {
|
|
28
|
+
background: {
|
|
29
|
+
base: theme.colors.neutral[800],
|
|
30
|
+
hover: theme.colors.neutral[1000],
|
|
31
|
+
active: theme.colors.neutral[700]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return sproutLightTheme;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default lightTheme;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/racine",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.5-sproutTheme-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"__flow__",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@styled-system/theme-get": "^5.1.2",
|
|
68
68
|
"classnames": "^2.2.6",
|
|
69
|
+
"just-clone": "^5.0.1",
|
|
69
70
|
"lodash.curry": "^4.1.1",
|
|
70
71
|
"lodash.uniqueid": "^4.0.1",
|
|
71
72
|
"lru-memoize": "^1.1.0",
|
package/bin/buildNpm.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file handles the generation of an .npmrc with Jfrog credentials during the CI process.
|
|
3
|
-
* It replicates the local configuration requirements of a developer running `yarn` on their machine
|
|
4
|
-
* If run locally please do not commit your auth credentials
|
|
5
|
-
*/
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
const https = require("https");
|
|
8
|
-
const { exit } = require("process");
|
|
9
|
-
|
|
10
|
-
const { ARTIFACTORY_KEY, CI } = process.env;
|
|
11
|
-
|
|
12
|
-
// Check if we're in CI context, otherwise skip the process
|
|
13
|
-
if (!CI) {
|
|
14
|
-
exit();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const options = {
|
|
18
|
-
hostname: "sproutsocial.jfrog.io",
|
|
19
|
-
path: "/artifactory/api/npm/auth",
|
|
20
|
-
method: "GET",
|
|
21
|
-
headers: {
|
|
22
|
-
"X-JFrog-Art-Api": ARTIFACTORY_KEY,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const req = https.request(options, (res) => {
|
|
27
|
-
console.log(`statusCode: ${res.statusCode}`);
|
|
28
|
-
|
|
29
|
-
// Call our auth endpoint with environment credentials
|
|
30
|
-
res.on("data", (data) => {
|
|
31
|
-
// Writes out an .npmrc file with the response
|
|
32
|
-
fs.writeFile(".npmrc", data, (err) => {
|
|
33
|
-
if (err) console.log(err);
|
|
34
|
-
else {
|
|
35
|
-
console.log(".npmrc generated successfully!");
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Once the file is created we append the registry info
|
|
40
|
-
fs.appendFile(
|
|
41
|
-
".npmrc",
|
|
42
|
-
"registry=https://sproutsocial.jfrog.io/artifactory/api/npm/npm_virtual",
|
|
43
|
-
function (err) {
|
|
44
|
-
if (err) throw err;
|
|
45
|
-
console.log("Registry Config Added!");
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
// Finally, we set permissions for the file so that netlify recognizes it
|
|
50
|
-
fs.chmodSync(".npmrc", "0600");
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
req.on("error", (error) => {
|
|
55
|
-
console.error(error);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
req.end();
|